import { Element } from '../../../fieldType'
import commonField from '../../../propertyPanel/commonConfig'
export interface AccessaryElement extends Element {
  defaultAttachList: object[]
  maxCount?: number // 上传最大数量
  singleMaxMb?: number // 单个文件限制MB
  definePostfixList: string[] // 自定义后缀集合
  attachFormat: number[] // 上传格式 1. 图片 2. 视频 3. 文档 4. 音频
  width: number
}
function formListFactory () {
  return [
    commonField.name,
    commonField.attrCode,
    { label: '上传附件格式', name: 'attachFormat', type: 'format' },
    { label: '上传数量及大小', name: 'uploadLimit', type: 'uploadLimit', number: 'maxCount', limit: 'singleMaxMb' },
    { label: '默认值', name: 'defaultAttachList', type: 'defaultAttachList' },
    commonField.width
  ]
}
const formList = formListFactory()
const formTemplate: AccessaryElement = {
  businessId: '',
  attrCode: '',
  name: '附件',
  defaultAttachList: [],
  attachFormat: [1],
  definePostfixList: [],
  fieldType: 'accessory',
  maxCount: 3,
  singleMaxMb: 10,
  width: 1
}
export default {
  formList,
  formTemplate
}
